package chat.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.security.Provider.Service;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginPage extends HttpServlet {
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		String path = req.getContextPath();
		
		//获取数据
		
		/*String msg = req.getParameter("msg");
		
		if(msg==null){
			msg = "";
		}*/
		
		PrintWriter w = resp.getWriter();
		w.println("<!DOCTYPE html>");
		w.println("<html>");
		w.println("<head>");
		w.println("<meta charset='utf-8' />");
		w.println("<title></title>");
		w.println("<style type='text/css'>");
		w.println("#LoginMain{");
		w.println("	width: 300px;");
		w.println("	height: 400px;");
		w.println("background-color: lightblue ;");
		w.println("text-align: center;");
		w.println("margin: 0 auto;");
		w.println("border-radius:30px;");
		w.println("box-shadow:10px 10px 20px lightblue;");
		w.println("}");
		w.println("#Head{");
		w.println("width:100%;");
		w.println("	height:15%;");
		w.println("background-color: whitesmoke;");
		w.println("border-radius:30px 30px 0px 0px;");
		w.println("}");
		w.println("#Head h1{");
		w.println("font-family: '微软雅黑';");
		w.println("color:lightblue;");
		w.println("text-align: center;");
		w.println("line-height:60px;");
		w.println("}");
		w.println(".bt{");
		w.println("		width: 80px;");
		w.println("	background-color: #00CED1;");
		w.println("color: white;");
		w.println("border: 1px;");
		w.println("border-radius: 5px;");
		w.println("background-color: #00CED1;");
		w.println("padding: 5px;");
		w.println("}");
		w.println("</style>");

		w.println("</head>");
		w.println("<body>");
		w.println("<div id='LoginMain' >");
		w.println("<div id='Head' >");
		w.println("<h1 >欢迎登陆</h1>");
		w.println("</div>");

		w.println("<div style='position:relative;top:100px;'>");
		w.println("<form action='" + path + "/LoginAction' method='post'>");
		w.println(
				"<span style='font-family: '微软雅黑';color:whitesmoke ;'>账号：</span><input type='text' name='name' value='''/><br /><br />");
		w.println(
				"<span style='font-family: '微软雅黑';color:whitesmoke ;'>密码：</span><input type='password' name='pwd'   ' /><br /><br /><br /><br /><br /><br />");
		w.println("<input class='bt' type='submit' value='登陆'  />&emsp;&emsp;");
		w.println("<a  href='" + path + "/text/Register'><input class='bt'  type='button' value='注册'/></a>");
		w.println("</form>");
		w.println("</div>");
		w.println("</div>");
		w.println("</body>");
		w.println("</html>");
		w.flush();
	}

}
